﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SubmitProject.aspx.cs" Inherits="dzs.Web.Outstorage.SubmitProject" EnableEventValidation="false" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <link href="../../css/myStyle.css" rel="stylesheet" />
    <link href="../../style.css" type="text/css" rel="stylesheet" />
    <script src="../My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="../Scripts/JsTools.js" type="text/javascript"></script>
    <script type="text/javascript">
        function checksel() {
            if ($("#<%= GridView1.ClientID %> tr :checkbox:checked").length > 0)
                return true;
            else
            { alert('没有选择任何行！'); return false; }

        }
    </script>

    <link href="../../jquery-ui.min.css" rel="stylesheet" />
    <script src="../../js/jquery.js"></script>
    <script src="../../js/jquery-ui.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#txt_projectName").autocomplete({
                minLength: 1, // 设置搜索的关键字最小长度// 设置自动完成列表的函数，函数包括两个参数，requset和response      
                source: function (request, response) {
                    $.ajax({
                        type: "POST",          // 通过request.term可以获得文本框内容   
                        url: "Handler.ashx?keyword=" + request.term,
                        contentType: "application/json; charset=gb2312",
                        dataType: "json",
                        success: function (data) {
                            // jQuery.map(array, callback) :将一个数组中的元素转换到另一个数组中。
                            //  下面就是把数组["value1", "value2",...]转换为[{value:"value1"}, {value:"value2"},...]                 
                            response($.map(data, function (item) {
                                return { value: item };
                            }));
                        },
                        error: function () {
                            alert("ajax请求失败");
                        }
                    });
                }
            });
        });

        $(function () {
            $("#txt_targetProject").autocomplete({
                minLength: 1, // 设置搜索的关键字最小长度// 设置自动完成列表的函数，函数包括两个参数，requset和response      
                source: function (request, response) {
                    $.ajax({
                        type: "POST",          // 通过request.term可以获得文本框内容   
                        url: "../../Handler.ashx?keyword=" + request.term,
                        contentType: "application/json; charset=gb2312",
                        dataType: "json",
                        success: function (data) {
                            // jQuery.map(array, callback) :将一个数组中的元素转换到另一个数组中。
                            //  下面就是把数组["value1", "value2",...]转换为[{value:"value1"}, {value:"value2"},...]                 
                            response($.map(data, function (item) {
                                return { value: item };
                            }));
                        },
                        error: function () {
                            alert("ajax请求失败");
                        }
                    });
                }
            });
        });

    </script>
</head>
<body style="font-size: 9pt; text-align:center;">
    <form id="form1" runat="server">
        <div style="margin-top: 10px; margin-bottom: 10px; text-align: left;">
            仓管员：<asp:Label ID="lbl_userName" runat="server"></asp:Label>
            ，请选择出库项目：<asp:TextBox ID="txt_projectName" runat="server"></asp:TextBox>
            &nbsp;,物料描述：<asp:TextBox ID="txt_material" runat="server"></asp:TextBox>
            <asp:Button ID="btn_selectProject" runat="server"
                OnClick="btn_selectProject_Click" Text="出库单" />
        </div>
        <div style="margin-top: 10px; margin-bottom: 10px;">
            <asp:GridView ID="GridView1" runat="server" Width="100%"
                AutoGenerateColumns="False" AllowPaging="True"
                OnPageIndexChanging="GridView1_PageIndexChanging">
                <Columns>
                    <asp:TemplateField HeaderText="选择">
                        <HeaderTemplate>
                            <input id="cbo_checkAll" type="checkbox" onclick="checkall(this)" />全选
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="cbo_check" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="预出库数量">
                        <ItemTemplate>
                            <asp:TextBox ID="txt_out_storage_count" runat="server" Width="50px"></asp:TextBox>
                            <asp:Label ID="lbl_material_id" runat="server" Text='<%# Bind("mid") %>'
                                Visible="False"></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="预出库时间" Visible="False"></asp:TemplateField>
                    <asp:TemplateField HeaderText="到货地点" Visible="False"></asp:TemplateField>
                    <asp:TemplateField HeaderText="接收人" Visible="False"></asp:TemplateField>
                    <asp:TemplateField HeaderText="接收人电话" Visible="False"></asp:TemplateField>
                    <asp:TemplateField HeaderText="剩余数量">
                        <ItemTemplate>
                            <asp:Label ID="lbl_realCount" runat="server" Text='<%# Bind("real_count") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("real_count") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="数量单位">
                        <ItemTemplate>
                            <asp:Label ID="lbl_unit" runat="server" Text='<%# Bind("unit") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("unit") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="项目编号">
                        <ItemTemplate>
                            <asp:Label ID="lbl_proid" runat="server" Text='<%# Bind("proid") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("proid") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="项目名称">
                        <ItemTemplate>
                            <asp:Label ID="lbl_projectname" runat="server"
                                Text='<%# Bind("projectname") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("projectname") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="usework" HeaderText="需用部门" />
                    <asp:BoundField DataField="supplier" HeaderText="供应商名称" />
                    <asp:TemplateField HeaderText="物料描述">
                        <ItemTemplate>
                            <asp:Label ID="lbl_material" runat="server" Text='<%# Bind("material") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("material") %>'></asp:TextBox>
                        </EditItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerStyle CssClass="mypager" />
            </asp:GridView>
        </div>

        <div style="text-align: left">
            出库时间：<asp:TextBox
                ID="txt_out_storage_Estimate" runat="server"
                onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})"></asp:TextBox>
            ，接收人：<asp:TextBox ID="txt_receive_userName" runat="server" Width="100px"></asp:TextBox>
            ，接收人电话：<asp:TextBox ID="txt_receive_userPhone" runat="server" Width="100px"></asp:TextBox>
            ，审核人：<asp:DropDownList ID="ddl_checkUser" runat="server">
            </asp:DropDownList>
            &nbsp;
        </div>
        <div style="margin-top: 10px; margin-bottom: 10px; text-align: left;">
            目的项目：<asp:TextBox ID="txt_targetProject" runat="server" Width="522px"></asp:TextBox>
        </div>
        <div style="margin-top: 10px; margin-bottom: 10px; text-align: left;">
            到货地点：<asp:TextBox ID="txt_receive_address" runat="server" Width="526px"></asp:TextBox>
        </div>
        <div style="margin-top: 10px; margin-bottom: 10px;">
            <asp:Button ID="btn_add" runat="server" Text="添加"
                OnClick="btn_add_Click" OnClientClick="return checksel();" />
            &nbsp;
    <asp:Button ID="btn_re" runat="server" Text="重置"
        OnClick="btn_re_Click" />
        </div>
        <div>
            <div style="text-align: center; font-weight: bold; font-size: 18px; margin-bottom: 10px; margin-top: 10px;">出 库 清 单 </div>
            <div>
                <asp:GridView ID="GridView2" runat="server" Width="100%"
                    AutoGenerateColumns="False" OnRowCommand="GridView2_RowCommand">
                    <Columns>
                         <asp:TemplateField HeaderText="操作">
                            <ItemTemplate>
                                <asp:LinkButton ID="lbn_del" runat="server" CommandArgument='<%# Bind("mid") %>' CommandName="lbl_ol_del" ForeColor="Blue">删除</asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="out_storage_count" HeaderText="预出库数量" />
                        <asp:BoundField DataField="material" HeaderText="物料描述" />
                        <asp:BoundField DataField="unit" HeaderText="数量单位" />
                        <asp:BoundField DataField="projectname" HeaderText="项目名称" />
                        <asp:BoundField DataField="proid" HeaderText="项目编号" />
                        <asp:BoundField DataField="mid" HeaderText="物料ID" Visible="False" />
                    </Columns>
                </asp:GridView>
            </div>
        </div>
        <div style="margin-top: 10px; margin-bottom: 10px;">
            <asp:Button ID="btn_submit" runat="server" Text="提交"
                OnClick="btn_submit_Click" />
        </div>
    </form>
</body>
</html>
